package bar.dark.lee.manager.money;

import bar.dark.lee.R;
import bar.dark.lee.setting.SettingActivity;
import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TabHost;

public class MoneyTabActivity extends TabActivity
{
	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		
		TabHost tabHost = getTabHost();
		
		Intent gIntent = getIntent();
		
		int moneyFlag = gIntent.getIntExtra(SettingActivity.MONEY_FLAG, 0);
		
		Intent intent1 = new Intent(this, RealMoneyActivity.class);
		
		Intent intent2 = new Intent(this, BankMoneyActivitiy.class);
		
		tabHost.addTab(tabHost.newTabSpec("현금")
				.setIndicator("현금", null)
				.setContent(intent1));
		tabHost.getTabWidget().getChildAt(0).setBackgroundResource(R.drawable.btn_set_tab);
		
		tabHost.addTab(tabHost.newTabSpec("통장")
				.setIndicator("통장", null)
				.setContent(intent2));
		tabHost.getTabWidget().getChildAt(1).setBackgroundResource(R.drawable.btn_set_tab);
		
		tabHost.addTab(tabHost.newTabSpec("")
				.setIndicator(new LinearLayout(this))
				.setContent(new Intent()));
		tabHost.getTabWidget().getChildAt(2).setVisibility(View.GONE);
		
//		tabHost.getTabWidget().getChildAt(0).setPadding(0, 10, 0, 10);
//		tabHost.getTabWidget().getChildAt(1).setPadding(0, 10, 0, 10);
		
		tabHost.setCurrentTab(getMoneyFlag(moneyFlag));
	}
	
	private int getMoneyFlag(int flag)
	{
		if (flag == SettingActivity.REAL_MONEY)
		{
			return 0;
		}
		else if (flag == SettingActivity.BANK_MONEY)
		{
			return 1;
		}
		
		return 0;
	}
}
